package by.admonko.universaltesting.services.impl;

import java.util.List;
import java.util.Set;

import javax.inject.Inject;

import org.springframework.stereotype.Service;

import by.admonko.universaltesting.dataaccess.TestDao;
import by.admonko.universaltesting.datamodel.Test;
import by.admonko.universaltesting.datamodel.UserGroup;
import by.admonko.universaltesting.datamodel.UserTbl;
import by.admonko.universaltesting.services.TestService;

@Service
public class TestServiceImpl implements TestService {
	@Inject
	TestDao testDao;

	@Override
	public Test getTest(Integer id) {
		return testDao.getById(id);

	}

	@Override
	public List<Test> getAllTest() {

		return testDao.getAll();
	}

	@Override
	public List<Test> getTestByGroup(Set<UserGroup> usGroup) {
		return testDao.getByUserGroup(usGroup);
	}

	@Override
	public List<Test> getTestByOwner(UserTbl user) {
		return testDao.getByUserOwner(user);
	}

	@Override
	public void setTest(Test test) {
		testDao.insert(test);

	}

	@Override
	public void updateTest(Test test) {
		testDao.update(test);

	}

	@Override
	public void removeTest(Integer id) {
		testDao.delete(id);

	}

	@Override
	public void removeTestList(List<Integer> list) {
		testDao.delete(list);

	}

}
